<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class WxUserFollow extends Model
{
	use HasDateTimeFormatter;
//    use SoftDeletes;

    protected $table = 'wx_user_follow';

    /**
     * 判断是否被关注
     * @param $uid
     * @param $userFollowId
     * @return mixed
     */
    public function isFollowUser($uid,$userFollowId)
    {
        return $this->where('user_id',$uid)
            ->where('user_follow_id',$userFollowId)
            ->exists();
    }


    public function user()
    {
        return $this->hasOne(WxUser::class,'id','user_id');
    }

    public function followUser()
    {
        return $this->hasOne(WxUser::class,'id','user_follow_id');
    }

}
